home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-11-12 | 54.1 KB | 2,211 lines |
- Newsgroups: comp.sources.misc
- From: sjg@zen.void.oz.au (Simon J. Gerraty)
- Subject: v25i054: pdksh - Public Domain Korn Shell, v4, Part08/09
- Message-ID: <1991Nov13.031239.16335@sparky.imd.sterling.com>
- X-Md4-Signature: d2a3ea33ae95c1dbadac751fda6e67bc
- Date: Wed, 13 Nov 1991 03:12:39 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: sjg@zen.void.oz.au (Simon J. Gerraty)
- Posting-number: Volume 25, Issue 54
- Archive-name: pdksh/part08
- Environment: UNIX
-
- #! /bin/sh
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # The tool that generated this appeared in the comp.sources.unix newsgroup;
- # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
- # Contents: Makefile ReadMe.vimode sh/Changes sh/Makefile sh/config.h
- # sh/tty.h sh/version.c std/Makefile std/posix/Makefile
- # std/posix/dirent.C std/posix/dirent.H std/posix/fcntl.c
- # std/posix/fcntl.h std/posix/fixincludes std/posix/times.c
- # std/posix/times.h std/posix/unistd.c std/posix/unistd.h
- # std/posix/wait.h std/stdc/Makefile std/stdc/clock.c
- # std/stdc/fprintf.c std/stdc/limits.h std/stdc/memcmp.c
- # std/stdc/memmove.c std/stdc/setvbuf.c std/stdc/sprintf.c
- # std/stdc/stdarg.h std/stdc/stddef.h std/stdc/stdio.sed
- # std/stdc/stdlib.h std/stdc/strchr.c std/stdc/strcmp.c
- # std/stdc/strcspn.c std/stdc/string.h std/stdc/strncat.c
- # std/stdc/strncmp.c std/stdc/strncpy.c std/stdc/strpbrk.c
- # std/stdc/strrchr.c std/stdc/strspn.c std/stdc/strstr.c
- # std/stdc/strtok.c std/stdc/time.h std/stdc/types.h
- # Wrapped by kent@sparky on Tue Nov 12 20:44:34 1991
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 8 (of 9)."'
- if test -f 'Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Makefile'\"
- else
- echo shar: Extracting \"'Makefile'\" \(557 characters\)
- sed "s/^X//" >'Makefile' <<'END_OF_FILE'
- X# PD Bourne/Korn Shell
- X#
- X
- XSHELL=/bin/sh
- X
- X#CONFIG= -D_SYSV
- X#CONFIG= -D_BSD
- X#CONFIG= -D_V7
- X#CONFIG= -D_ST /* Atari ST */
- X
- XMANPAGES = ksh.1
- X#INSTALL=bsdinstall
- XINSTALL=install
- X
- Xall: ksh
- X
- Xksh: libs
- X ( cd sh ; $(MAKE) 'CC=$(CC)' 'CONFIG=$(CONFIG)' $@ )
- X
- Xlibs:
- X ( cd std ; $(MAKE) 'CC=$(CC)' 'CONFIG=$(CONFIG)' $@ )
- X
- Xinstall: sh/ksh
- X ( cd sh ; $(INSTALL) -s ksh $(HCRDESTDIR)/bin )
- X
- Xsh/ksh: ksh
- X
- Xinst-man: $(MANPAGES)
- X $(INSTALL) -c -m 444 $(MANPAGES) $(HCRDESTDIR)/man/u_man/man1
- X
- Xclean clobber:
- X ( cd std ; $(MAKE) $@ )
- X ( cd sh ; $(MAKE) $@ )
- X -rm -f *.out
- X
- END_OF_FILE
- if test 557 -ne `wc -c <'Makefile'`; then
- echo shar: \"'Makefile'\" unpacked with wrong size!
- fi
- # end of 'Makefile'
- fi
- if test -f 'ReadMe.vimode' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'ReadMe.vimode'\"
- else
- echo shar: Extracting \"'ReadMe.vimode'\" \(1317 characters\)
- sed "s/^X//" >'ReadMe.vimode' <<'END_OF_FILE'
- X
- XThe changes I have made are all relevant to the VI edit mode. The vi-edit
- Xsource seems mostly complete, so these changes are minimal. What is available
- Xnow is pretty useful. I will make further fixes as I notice the bugs (or
- Xanyone else does).
- X
- XA summary of changes follows:
- X
- X1) two changes to turn on the vi-editing feature.
- X2) motion edit fix: back space and space bar now do something: have
- Xthe same behaviour as the 'h' and 'l' keys.
- X3) input edit fix: backspace key now works.
- X
- XKnown bugs (not fixed yet):
- X
- Xa) proviso on 1) and 2) above: the backspace key was hardwired to the
- X<delete> key. I have temporarily extended it to include the '^H' or
- X<backspace> key. I will generalize this to use whatever key is defined
- Xas the erase character by stty.
- X
- Xb) the interrupt key does not clear the edit buffer. This means the next
- Xedit command after an interrupt will be garbage.
- X
- Xc) Same sort of thing as b) occurs for the <EOF> key.
- X
- Xd) insertions near the beginning of an edit buffer seem to screw up the rest
- Xof the buffer.
- X
- XKnown missing features:
- X
- Xa) search edit commands: [count]-, [count]+
- Xb) text modification edit commands: P, p, *
- Xc) r (replace) doesn't seem to work too well.
- Xd) tilde does not do anything (should reverse upper to lower and vice versa)
- X
- Xe) ! in prompt doesn't get expanded to history number
- END_OF_FILE
- if test 1317 -ne `wc -c <'ReadMe.vimode'`; then
- echo shar: \"'ReadMe.vimode'\" unpacked with wrong size!
- fi
- # end of 'ReadMe.vimode'
- fi
- if test -f 'sh/Changes' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'sh/Changes'\"
- else
- echo shar: Extracting \"'sh/Changes'\" \(596 characters\)
- sed "s/^X//" >'sh/Changes' <<'END_OF_FILE'
- XFix echo $$ | cat
- X#if and config option cleanup
- XFix let evaluation of null/unset vars
- Xalloc improvement
- XFix accidental SCCS keywords
- XFix Xstring overwriting in lex.c
- XPrint here doc temp file when printing I/O actions
- XAdd more slack on end of Xstrings
- XFix up test(1) parsing
- XRun shell scripts with EXECSHELL
- XMake temp files 0600
- XMake unset -f work
- XMake trailing blank or tab in alias work
- XFix command completion bug
- X--------------------------------------------------
- XFix "cd / foo"
- XFix getopts accidentally resetting itself
- X--------------------------------------------------
- XFix whence exit codes
- END_OF_FILE
- if test 596 -ne `wc -c <'sh/Changes'`; then
- echo shar: \"'sh/Changes'\" unpacked with wrong size!
- fi
- # end of 'sh/Changes'
- fi
- if test -f 'sh/Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'sh/Makefile'\"
- else
- echo shar: Extracting \"'sh/Makefile'\" \(1126 characters\)
- sed "s/^X//" >'sh/Makefile' <<'END_OF_FILE'
- X# PD Bourne/Korn Shell
- X# NOTE: the are no depencies of .c file on .h files yet.
- X
- XSHELL = /bin/sh
- X
- X# This is for the sun386i your mileage may vary :-)
- X#CC=gcc -ansi -Dsun386 -Dsun -Di386
- X
- X#CONFIG= -D_SYSV
- XCONFIG= -D_BSD
- X
- XSTD= ../std
- X
- X#CC = shcc
- XCCOPTS = $(DBG)
- XCFLAGS = $(CCOPTS) -I$(STD)/h $(CONFIG)
- X
- X#LDOPTS = -s
- XLDFLAGS = $(LDOPTS) -L$(STD)
- X
- XCOMPATLIBS = -lstdc # -lposix
- X#OTHERLIBS = -lc_s
- X#OTHERLIBS = -ldirent
- XLDLIBS = $(COMPATLIBS) $(OTHERLIBS)
- X
- XHDRS = sh.h table.h expand.h lex.h tree.h tty.h trace.h
- XSRCS1 = version.c main.c misc.c trap.c alloc.c io.c \
- X syn.c lex.c edit.c emacs.c vi.c history.c tree.c
- XSRCS2 = exec.c jobs.c \
- X c_sh.c c_ksh.c c_test.c getopts.c ulimit.c \
- X var.c table.c eval.c expr.c mail.c trace.c
- XSRCS = Makefile $(HDRS) $(SRCS1) $(SRCS2)
- X
- XOBJS = version.o main.o misc.o \
- X syn.o lex.o edit.o emacs.o vi.o tree.o \
- X exec.o jobs.o trap.o \
- X c_sh.o c_ksh.o c_test.o \
- X ulimit.o getopts.o expr.o history.o \
- X var.o table.o alloc.o io.o eval.o mail.o trace.o
- X
- Xksh: $(OBJS)
- X $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
- X
- Xclean:
- X rm -f *.o *.out core
- X
- Xclobber: clean
- X rm -f ksh
- X
- X
- Xedit.o emacs.o: edit.h
- END_OF_FILE
- if test 1126 -ne `wc -c <'sh/Makefile'`; then
- echo shar: \"'sh/Makefile'\" unpacked with wrong size!
- fi
- # end of 'sh/Makefile'
- fi
- if test -f 'sh/config.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'sh/config.h'\"
- else
- echo shar: Extracting \"'sh/config.h'\" \(594 characters\)
- sed "s/^X//" >'sh/config.h' <<'END_OF_FILE'
- X/*
- X * Configuration file for the PD ksh
- X */
- X
- X#ifndef _CONFIG_H
- X#define _CONFIG_H
- X
- X/*
- X * Builtin edit modes
- X */
- X
- X#define EMACS /* EMACS-like mode */
- X#define VI /* vi-like mode */
- X
- X/*
- X * Various compilation options. They are defined to 1 because
- X * the original code uses #if a lot, and some versions of cpp
- X * seem to choke on #if NOTDEF
- X */
- X
- X#define JOBS /* job control */
- X/* #define FASCIST /* Fascist getopts */
- X#define SHARPBANG /* Hack to handle #! */
- X/* #define SILLY /* Game of life in EMACS mode */
- X/* #define SWTCH /* Handle SWTCH for shl(1) */
- X
- X#endif /* _CONFIG_H */
- END_OF_FILE
- if test 594 -ne `wc -c <'sh/config.h'`; then
- echo shar: \"'sh/config.h'\" unpacked with wrong size!
- fi
- # end of 'sh/config.h'
- fi
- if test -f 'sh/tty.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'sh/tty.h'\"
- else
- echo shar: Extracting \"'sh/tty.h'\" \(596 characters\)
- sed "s/^X//" >'sh/tty.h' <<'END_OF_FILE'
- X/*
- X tty.h -- centralized definitions for a variety of terminal interfaces
- X
- X created by DPK, Oct. 1986
- X
- X last edit: 30-Jul-1987 D A Gwyn
- X*/
- X
- X#if _BSD_SYSV /* BRL UNIX System V emulation */
- X#include <termio.h> /* includes <sys/_ioctl.h> */
- X#ifndef NTTYDISC
- X#define TIOCGETD _IOR( 't', 0, int )
- X#define TIOCSETD _IOW( 't', 1, int )
- X#define NTTYDISC 2
- X#endif
- X#ifndef TIOCSTI
- X#define TIOCSTI _IOW( 't', 114, char )
- X#endif
- X#ifndef TIOCSPGRP
- X#define TIOCSPGRP _IOW( 't', 118, int )
- X#endif
- X#else /* !_BSD_SYSV */
- X#if _BSD
- X#include <sys/ioctl.h>
- X#else
- X#include <termio.h>
- X#endif
- X#endif /* _BSD_SYSV */
- END_OF_FILE
- if test 596 -ne `wc -c <'sh/tty.h'`; then
- echo shar: \"'sh/tty.h'\" unpacked with wrong size!
- fi
- # end of 'sh/tty.h'
- fi
- if test -f 'sh/version.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'sh/version.c'\"
- else
- echo shar: Extracting \"'sh/version.c'\" \(751 characters\)
- sed "s/^X//" >'sh/version.c' <<'END_OF_FILE'
- X/*
- X * value of $KSH_VERSION
- X */
- X
- X#ifndef lint
- Xstatic char *RCSid = "$Id: version.c,v 3.3 89/03/27 15:52:29 egisin Exp $";
- Xstatic char *sccs_id = "@(#)version.c 4.1 91/11/09 14:55:16 (sjg)";
- X#endif
- X
- X#include <stddef.h>
- X#include <setjmp.h>
- X#include "sh.h"
- X
- Xchar ksh_version [] =
- X "KSH_VERSION=@(#)PD KSH v4.1 91/11/09 14:55:16";
- X
- X/***
- X$Log: version.c,v $
- XVersion 4.0 91/11/09 sjg
- Xdistribution
- XRevision 3.3 89/03/27 15:52:29 egisin
- Xdistribution
- X
- XRevision 3.2 88/12/14 20:10:41 egisin
- Xmany fixes
- X
- XRevision 3.1 88/11/03 09:18:36 egisin
- Xalpha distribution
- X
- XRevision 1.3 88/10/20 17:34:03 egisin
- Xadded @(#) to ksh_version
- X
- XRevision 1.2 88/09/27 19:01:58 egisin
- Xfix version.c
- X
- XRevision 1.1 88/09/27 18:59:06 egisin
- XInitial revision
- X***/
- X
- END_OF_FILE
- if test 751 -ne `wc -c <'sh/version.c'`; then
- echo shar: \"'sh/version.c'\" unpacked with wrong size!
- fi
- # end of 'sh/version.c'
- fi
- if test -f 'std/Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/Makefile'\"
- else
- echo shar: Extracting \"'std/Makefile'\" \(760 characters\)
- sed "s/^X//" >'std/Makefile' <<'END_OF_FILE'
- X#
- X# Makefile for the compatibility libraries
- X#
- X
- XSHELL = /bin/sh
- X
- X#CONFIG = -D_SYSV
- XCONFIG = -D_BSD
- X
- XLN = ln
- X
- Xlibs: h libstdc.a #libposix.a
- X
- Xh:
- X mkdir h
- X ( cd stdc ; $(MAKE) 'CC=$(CC)' 'CONFIG=$(CONFIG)' clobber link )
- X ( cd posix ; $(MAKE) 'CC=$(CC)' 'CONFIG=$(CONFIG)' clobber link )
- X
- Xlibstdc.a: FORCED
- X ( cd stdc ; $(MAKE) 'CC=$(CC)' 'CONFIG=$(CONFIG)' $@ )
- X -$(LN) stdc/$@ $@
- X
- Xlibposix.a: FORCED
- X ( cd posix ; $(MAKE) 'CC=$(CC)' 'CONFIG=$(CONFIG)' $@ )
- X -$(LN) posix/$@ .
- X
- Xclean:
- X -rm -f *.out
- X ( cd stdc ; $(MAKE) 'CC=$(CC)' 'CONFIG=$(CONFIG)' $@ )
- X ( cd posix ; $(MAKE) 'CC=$(CC)' 'CONFIG=$(CONFIG)' $@ )
- X
- Xclobber:
- X -rm -rf h *.a
- X ( cd stdc ; $(MAKE) 'CC=$(CC)' 'CONFIG=$(CONFIG)' $@ )
- X ( cd posix ; $(MAKE) 'CC=$(CC)' 'CONFIG=$(CONFIG)' $@ )
- X
- XFORCED:
- END_OF_FILE
- if test 760 -ne `wc -c <'std/Makefile'`; then
- echo shar: \"'std/Makefile'\" unpacked with wrong size!
- fi
- # end of 'std/Makefile'
- fi
- if test -f 'std/posix/Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/posix/Makefile'\"
- else
- echo shar: Extracting \"'std/posix/Makefile'\" \(847 characters\)
- sed "s/^X//" >'std/posix/Makefile' <<'END_OF_FILE'
- X# POSIX P1003.1 compatability
- X
- XSHELL = /bin/sh
- X
- X# This is for the sun386i your mileage may vary :-)
- X#CC=gcc -ansi -Dsun386 -Dsun -Di386
- X
- X#CONFIG = -D_SYSV
- XCONFIG = -D_BSD
- X
- XLN = ln
- XRANLIB = ranlib # For BSD systems
- X#RANLIB = echo Updated
- X
- XLIB = libposix.a
- XINCL = ../h
- X
- XCFLAGS = $(CCOPTS) -I$(INCL) $(CONFIG)
- X
- XMISC = Makefile
- XHDRS = io.h wait.h times.h unistd.h fcntl.h dirent.h
- XSRCS = unistd.c fcntl.c times.c dup2.c
- XOBJS = unistd.o fcntl.o times.o dup2.o
- X
- Xall: $(LIB)
- X
- Xlink: $(HDRS)
- X [ -d $(INCL) ] || mkdir $(INCL)
- X [ -d $(INCL)/sys ] || mkdir $(INCL)/sys
- X -$(LN) wait.h time.h times.h $(INCL)/sys
- X -$(LN) io.h fcntl.h unistd.h $(INCL)
- X -if [ ! -r /usr/include/unistd.h ]; then $(LN) dirent.h $(INCL); fi
- X
- X$(LIB): $(OBJS)
- X ar r $@ $?
- X $(RANLIB) $@
- X
- Xclean:
- X -rm -f *.o *.out
- X
- Xclobber: clean
- X -rm -f $(LIB)
- X
- Xfcntl.o: fcntl.h
- X
- Xtimes.o: times.h
- END_OF_FILE
- if test 847 -ne `wc -c <'std/posix/Makefile'`; then
- echo shar: \"'std/posix/Makefile'\" unpacked with wrong size!
- fi
- # end of 'std/posix/Makefile'
- fi
- if test -f 'std/posix/dirent.C' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/posix/dirent.C'\"
- else
- echo shar: Extracting \"'std/posix/dirent.C'\" \(1037 characters\)
- sed "s/^X//" >'std/posix/dirent.C' <<'END_OF_FILE'
- X/*
- X * simple implementation of directory(3) routines for V7 and Minix.
- X * completly untested. not designed to be efficient.
- X * missing telldir and seekdir.
- X */
- X
- X#include <sys/types.h>
- X#include <dirent.h>
- X
- Xchar *malloc();
- X
- X#define DIRSIZ 14
- Xstruct direct_v7
- X{
- X unsigned short d_ino;
- X char d_name[DIRSIZ];
- X};
- X
- XDIR *opendir(filename)
- X char *filename;
- X{
- X DIR *dirp;
- X
- X dirp = (DIR *) malloc(sizeof(DIR));
- X if (dirp == NULL)
- X return NULL;
- X dirp->fd = open(filename, 0);
- X if (dirp->fd < 0) {
- X free((char *) dirp);
- X return NULL;
- X }
- X return dirp;
- X}
- X
- Xstruct dirent *readdir(dirp)
- X register DIR *dirp;
- X{
- X static struct direct_v7 ent;
- X
- X while (read(dirp->fd, (char *)&ent, (int)sizeof(ent)) == sizeof(ent))
- X if (ent.d_ino != 0)
- X goto found;
- X return (struct dirent *) NULL;
- X found:
- X dirp->ent.d_ino = ent.d_ino;
- X strncpy(dirp->ent.d_name, ent.d_name, DIRSIZ);
- X return &dirp->ent;
- X}
- X
- Xvoid rewinddir(dirp)
- X DIR *dirp;
- X{
- X lseek(dirp->fd, 0L, 0);
- X}
- X
- Xclosedir(dirp)
- X DIR *dirp;
- X{
- X close(dirp->fd);
- X dirp->fd = -1;
- X free((char *) dirp);
- X return 0;
- X}
- END_OF_FILE
- if test 1037 -ne `wc -c <'std/posix/dirent.C'`; then
- echo shar: \"'std/posix/dirent.C'\" unpacked with wrong size!
- fi
- # end of 'std/posix/dirent.C'
- fi
- if test -f 'std/posix/dirent.H' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/posix/dirent.H'\"
- else
- echo shar: Extracting \"'std/posix/dirent.H'\" \(880 characters\)
- sed "s/^X//" >'std/posix/dirent.H' <<'END_OF_FILE'
- X/*
- X <sys/dirent.h> -- file system independent directory entry (SVR3)
- X
- X last edit: 25-Apr-1987 D A Gwyn
- X last hack: 14-Aug-1987 Eric Gisin
- X
- X prerequisite: <sys/types.h>
- X*/
- X
- X#define MAXNAMLEN 16 /* maximum filename length */
- X
- Xstruct dirent /* data from getdents()/readdir() */
- X {
- X long d_ino; /* inode number of entry */
- X off_t d_off; /* offset of disk directory entry */
- X unsigned short d_reclen; /* length of this record */
- X char d_name[MAXNAMLEN]; /* name of file */
- X};
- X
- X#ifndef NAME_MAX
- X#define NAME_MAX (MAXNAMLEN - 1) /* DAG -- added for POSIX */
- X#endif
- X
- Xtypedef struct { /* returned by opendir() */
- X int fd;
- X struct dirent ent;
- X} DIR;
- X
- Xextern DIR *opendir();
- Xextern struct dirent *readdir();
- Xextern off_t telldir();
- Xextern void seekdir();
- Xextern void rewinddir();
- Xextern int closedir();
- X
- X#ifndef NULL
- X#define NULL 0 /* DAG -- added for convenience */
- X#endif
- END_OF_FILE
- if test 880 -ne `wc -c <'std/posix/dirent.H'`; then
- echo shar: \"'std/posix/dirent.H'\" unpacked with wrong size!
- fi
- # end of 'std/posix/dirent.H'
- fi
- if test -f 'std/posix/fcntl.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/posix/fcntl.c'\"
- else
- echo shar: Extracting \"'std/posix/fcntl.c'\" \(430 characters\)
- sed "s/^X//" >'std/posix/fcntl.c' <<'END_OF_FILE'
- X/* fcntl emulation */
- X
- X#include <errno.h>
- X#include <sys/types.h>
- X#include <unistd.h>
- X#include <fcntl.h>
- X
- X#if _V7
- X
- X#include <sgtty.h>
- X
- Xint
- Xfcntl(fd, cmd, arg)
- X int fd, cmd, arg;
- X{
- X switch (cmd) {
- X case F_SETFD: /* set fd flags */
- X ioctl(fd, (arg&FD_CLEXEC) ? FIOCLEX : FIONCLEX, (char *)NULL);
- X break;
- X case F_DUPFD: /* dup fd */
- X /* this one is fun. find an unused fd >= arg and dup2 */
- X break;
- X }
- X return 0;
- X}
- X
- X#endif
- X
- END_OF_FILE
- if test 430 -ne `wc -c <'std/posix/fcntl.c'`; then
- echo shar: \"'std/posix/fcntl.c'\" unpacked with wrong size!
- fi
- # end of 'std/posix/fcntl.c'
- fi
- if test -f 'std/posix/fcntl.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/posix/fcntl.h'\"
- else
- echo shar: Extracting \"'std/posix/fcntl.h'\" \(437 characters\)
- sed "s/^X//" >'std/posix/fcntl.h' <<'END_OF_FILE'
- X/* P1003.1 fcntl/open definitions */
- X/* Based on a version by Terrence W. Holm */
- X
- X/* for fcntl(2) */
- X
- X#define F_DUPFD 0
- X#define F_GETFD 1
- X#define F_SETFD 2
- X#define F_GETFL 3
- X#define F_SETFL 4
- X
- X#define FD_CLEXEC 1 /* fcntl F_SETFD close on exec mode */
- X
- X/* for open(2) */
- X
- X#define O_RDONLY 0
- X#define O_WRONLY 1
- X#define O_RDWR 2
- X
- X#if _BSD
- X#undef O_RDONLY
- X#undef O_WRONLY
- X#undef O_RDWR
- X#include "/./usr/include/fcntl.h"
- X#endif
- X
- END_OF_FILE
- if test 437 -ne `wc -c <'std/posix/fcntl.h'`; then
- echo shar: \"'std/posix/fcntl.h'\" unpacked with wrong size!
- fi
- # end of 'std/posix/fcntl.h'
- fi
- if test -f 'std/posix/fixincludes' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/posix/fixincludes'\"
- else
- echo shar: Extracting \"'std/posix/fixincludes'\" \(799 characters\)
- sed "s/^X//" >'std/posix/fixincludes' <<'END_OF_FILE'
- X# Install modified versions of certain ANSI-incompatible system header files
- X# which are fixed to work correctly with ANSI C
- X# and placed in a directory that GNU C will search.
- X# This works properly on a Sun in system version 3.4;
- X# for other versions, you had better check.
- X
- Xmkdir /usr/local/lib/gcc-include
- Xmkdir /usr/local/lib/gcc-include/sys
- Xcp /usr/include/sys/ioctl.h /usr/local/lib/gcc-include/sys/ioctl.h
- Xchmod +w /usr/local/lib/gcc-include/sys/ioctl.h
- Xex /usr/local/lib/gcc-include/sys/ioctl.h <<\EOF
- Xg/_IO/s/(\(.\),/('\1',/
- Xg/#define._IO/s/'x'/x/g
- Xwq
- XEOF
- X
- Xcp /usr/include/sys/ttychars.h /usr/local/lib/gcc-include/sys/ttychars.h
- Xchmod +w /usr/local/lib/gcc-include/sys/ttychars.h
- Xex /usr/local/lib/gcc-include/sys/ttychars.h <<\EOF
- Xg/CTRL/s/(\(.\))/('\1')/
- Xg/#define.CTRL/s/'c'/c/g
- Xwq
- XEOF
- END_OF_FILE
- if test 799 -ne `wc -c <'std/posix/fixincludes'`; then
- echo shar: \"'std/posix/fixincludes'\" unpacked with wrong size!
- fi
- # end of 'std/posix/fixincludes'
- fi
- if test -f 'std/posix/times.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/posix/times.c'\"
- else
- echo shar: Extracting \"'std/posix/times.c'\" \(1126 characters\)
- sed "s/^X//" >'std/posix/times.c' <<'END_OF_FILE'
- X/* P1003.1 times emulation */
- X
- X#include <sys/times.h>
- X
- X#if _BSD
- X
- X#include <sys/time.h>
- X#include <sys/resource.h>
- X
- Xstatic long base_tv_sec = 0;
- X
- Xclock_t
- Xtimes(tmsp)
- X register struct tms *tmsp;
- X{
- X struct timeval tv;
- X struct rusage ru;
- X
- X getrusage(RUSAGE_SELF, &ru);
- X tmsp->tms_utime = ru.ru_utime.tv_sec*CLK_TCK
- X + (long)ru.ru_utime.tv_usec*CLK_TCK/1000000;
- X tmsp->tms_stime = ru.ru_stime.tv_sec*CLK_TCK
- X + (long)ru.ru_stime.tv_usec*CLK_TCK/1000000;
- X getrusage(RUSAGE_CHILDREN, &ru);
- X tmsp->tms_cutime = ru.ru_utime.tv_sec*CLK_TCK
- X + (long)ru.ru_utime.tv_usec*CLK_TCK/1000000;
- X tmsp->tms_cstime = ru.ru_stime.tv_sec*CLK_TCK
- X + (long)ru.ru_stime.tv_usec*CLK_TCK/1000000;
- X
- X gettimeofday(&tv, (struct timezone *)NULL);
- X if (base_tv_sec == 0)
- X base_tv_sec = tv.tv_sec;
- X tv.tv_sec -= base_tv_sec; /* prevent clock_t overflow */
- X return tv.tv_sec*CLK_TCK + (long)tv.tv_usec*CLK_TCK/1000000;
- X}
- X
- X#endif
- X
- X#if _V7
- X
- Xclock_t
- Xtimes(tmsp)
- X struct tms *tmsp;
- X{
- X struct timeb tb;
- X
- X#undef times /* access real times() */
- X times(tmsp);
- X#define times times_
- X ftime(&tb);
- X return tb.time*CLK_TCK + (long)tb.millitm*CLK_TCK/1000;
- X}
- X
- X#endif
- X
- END_OF_FILE
- if test 1126 -ne `wc -c <'std/posix/times.c'`; then
- echo shar: \"'std/posix/times.c'\" unpacked with wrong size!
- fi
- # end of 'std/posix/times.c'
- fi
- if test -f 'std/posix/times.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/posix/times.h'\"
- else
- echo shar: Extracting \"'std/posix/times.h'\" \(355 characters\)
- sed "s/^X//" >'std/posix/times.h' <<'END_OF_FILE'
- X/*
- X * sys/times.h: POSIX times()
- X */
- X
- X#if ! _TIMES_H
- X#define _TIMES_H 1
- X
- X#include <time.h> /* defines CLK_TCK */
- X
- X#if __STDC__
- X#define ARGS(args) args
- X#else
- X#define ARGS(args) ()
- X#endif
- X
- Xstruct tms {
- X clock_t tms_utime, tms_stime;
- X clock_t tms_cutime, tms_cstime;
- X};
- X
- X#if _V7
- X#define times times_
- X#endif
- X
- Xclock_t times ARGS((struct tms *tmsp));
- X
- X#endif
- X
- END_OF_FILE
- if test 355 -ne `wc -c <'std/posix/times.h'`; then
- echo shar: \"'std/posix/times.h'\" unpacked with wrong size!
- fi
- # end of 'std/posix/times.h'
- fi
- if test -f 'std/posix/unistd.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/posix/unistd.c'\"
- else
- echo shar: Extracting \"'std/posix/unistd.c'\" \(459 characters\)
- sed "s/^X//" >'std/posix/unistd.c' <<'END_OF_FILE'
- X/* misc. POSIX emulation */
- X
- X/* $Header$ */
- X
- X#include <string.h>
- X#include <errno.h>
- X#include <sys/types.h>
- X#include <unistd.h>
- X
- X#if _V7 || _BSD
- X
- Xchar *
- Xgetcwd(buf, len)
- X char *buf;
- X size_t len;
- X{
- X char cwd [1024];
- X extern char *getwd();
- X if (getwd(cwd) == NULL)
- X return NULL;
- X if (strlen(cwd)+1 >= len) {
- X errno = ERANGE;
- X return NULL;
- X }
- X return strcpy(buf, cwd);
- X}
- X
- X#endif
- X
- X#if _V7
- X
- Xlong
- Xulimit(cmd, limit)
- X int cmd;
- X long limit;
- X{
- X return 0;
- X}
- X
- X#endif
- X
- END_OF_FILE
- if test 459 -ne `wc -c <'std/posix/unistd.c'`; then
- echo shar: \"'std/posix/unistd.c'\" unpacked with wrong size!
- fi
- # end of 'std/posix/unistd.c'
- fi
- if test -f 'std/posix/unistd.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/posix/unistd.h'\"
- else
- echo shar: Extracting \"'std/posix/unistd.h'\" \(782 characters\)
- sed "s/^X//" >'std/posix/unistd.h' <<'END_OF_FILE'
- X/* unistd.h: misc. P1003.1 definitions */
- X/* Based on a version by Terrence W. Holm */
- X
- X#if ! _UNISTD_H
- X#define _UNISTD_H 1
- X
- X#include <stddef.h>
- X
- X/* doesn't really belong here, but the library function need it */
- X/* todo: use _ARGS, _Void, _Const */
- X#if __STDC__
- X#define ARGS(args) args
- X#define Void void
- X#define Const const
- X#else
- X#define ARGS(args) ()
- X#define Void char
- X#define Const
- X#endif
- X
- X#include <io.h> /* POSIX IO functions */
- X
- X/* for access(2) */
- X
- X#define R_OK 4
- X#define W_OK 2
- X#define X_OK 1
- X#define F_OK 0
- X
- X/* for lockf(2) */
- X
- X#define F_ULOCK 0
- X#define F_LOCK 1
- X#define F_TLOCK 2
- X#define F_TEST 3
- X
- X/* for lseek(2) */
- X
- X#define SEEK_SET 0
- X#define SEEK_CUR 1
- X#define SEEK_END 2
- X
- X#define IN_PATH "/usr/include"
- X
- Xchar *getcwd ARGS ((char *buf, size_t len));
- X
- X#endif
- X
- END_OF_FILE
- if test 782 -ne `wc -c <'std/posix/unistd.h'`; then
- echo shar: \"'std/posix/unistd.h'\" unpacked with wrong size!
- fi
- # end of 'std/posix/unistd.h'
- fi
- if test -f 'std/posix/wait.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/posix/wait.h'\"
- else
- echo shar: Extracting \"'std/posix/wait.h'\" \(1017 characters\)
- sed "s/^X//" >'std/posix/wait.h' <<'END_OF_FILE'
- X/*
- X * POSIX <sys/wait.h>
- X */
- X#if __STDC__
- X#define ARGS(args) args
- X#else
- X#define ARGS(args) ()
- X#endif
- X
- X#ifndef sparc
- Xtypedef int pid_t; /* belong in sys/types.h */
- X#endif
- X
- X#ifdef sparc
- X# include "/usr/include/sys/wait.h"
- X#else
- X
- X/* waitpid options */
- X#define WNOHANG 1 /* don't hang in wait */
- X#define WUNTRACED 2 /* tell about stopped, untraced children */
- X
- X#define WSTOPPED 0x7F /* process is stopped */
- X
- X#define WIFSTOPPED(x) (((x)&0xFF) == 0x7F)
- X#define WIFSIGNALED(x) (((x)&0xFF) != 0x7F && ((x)&0x7F) != 0)
- X#define WIFEXITED(x) (((x)&0xFF) != 0x7F && ((x)&0x7F) == 0)
- X#define WIFCORED(x) (!!((x)&0x80)) /* non-standard */
- X#define WEXITSTATUS(x) ((x)>>8&0xFF)
- X#define WTERMSIG(x) ((x)&0x7F)
- X#define WSTOPSIG(x) ((x)>>8&0xFF)
- X
- Xpid_t wait ARGS((int *statp));
- X#if _BSD
- Xpid_t wait3 ARGS((int *statp, int options, Void *));
- X/* todo: does not emulate pid argument */
- X#define waitpid(pid, sp, opts) wait3(sp, opts, (Void*)NULL)
- X#else
- Xpid_t waitpid ARGS((pid_t pid, int *statp, int options));
- X#endif
- X
- X#endif /* sparc */
- END_OF_FILE
- if test 1017 -ne `wc -c <'std/posix/wait.h'`; then
- echo shar: \"'std/posix/wait.h'\" unpacked with wrong size!
- fi
- # end of 'std/posix/wait.h'
- fi
- if test -f 'std/stdc/Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/Makefile'\"
- else
- echo shar: Extracting \"'std/stdc/Makefile'\" \(1235 characters\)
- sed "s/^X//" >'std/stdc/Makefile' <<'END_OF_FILE'
- X# Standard C (ANSI) compatabilaty
- X
- XSHELL = /bin/sh
- X
- X# This is for the sun386i your mileage may vary :-)
- X#CC=gcc -ansi -Dsun386 -Dsun -Di386
- X
- X#CONFIG = -D_SYSV
- XCONFIG = -D_BSD
- X
- XLN = ln
- XRANLIB = ranlib # For BSD systems
- X#RANLIB = echo Updated
- X
- XLIB = libstdc.a
- XINCL = ../h
- X
- XCFLAGS = $(CCOPTS) -I$(INCL) $(CONFIG)
- X
- XMISC = Makefile stdio.h_std
- XHDRS = limits.h stddef.h stdlib.h string.h time.h stdarg.h
- XSRCS = strstr.c memmove.c stdio.c #clock.c
- XOBJS = strstr.o memmove.o stdio.o #clock.o
- X
- Xall: $(LIB)
- X
- Xlink: $(HDRS) stdio.h
- X [ -d $(INCL) ] || mkdir $(INCL)
- X [ -d $(INCL)/sys ] || mkdir $(INCL)/sys
- X -$(LN) types.h $(INCL)/sys
- X -$(LN) limits.h stddef.h stdlib.h stdio.h string.h time.h stdarg.h $(INCL)
- X
- X$(LIB): $(OBJS)
- X ar r $@ $?
- X $(RANLIB) $@
- X
- Xstdio.h: stdio.h_std stdio.sed /usr/include/stdio.h
- X sed -f stdio.sed </usr/include/stdio.h >stdio.hacked
- X sed <stdio.h_std >stdio.h -e '/%%%/ r stdio.hacked'
- X rm stdio.hacked
- X
- Xclean:
- X -rm -f *.o *.out stdio.hacked
- X
- Xclobber: clean
- X -rm -f $(LIB) stdio.h
- X
- Xstring.h: stddef.h
- X
- Xstdlib.h: stddef.h
- X
- Xstdio.h: stddef.h
- X
- Xtime.h: stddef.h
- X
- Xstdio.o: stdio.h
- X
- Xsetvbuf.o: stdlib.h stdio.h
- X
- Xfprintf.o: stdarg.h stdio.h
- X
- Xsprintf.o: stdarg.h stdio.h
- X
- Xvprintf.o: stdarg.h stdio.h
- X
- Xstrstr.o: string.h
- X
- END_OF_FILE
- if test 1235 -ne `wc -c <'std/stdc/Makefile'`; then
- echo shar: \"'std/stdc/Makefile'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/Makefile'
- fi
- if test -f 'std/stdc/clock.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/clock.c'\"
- else
- echo shar: Extracting \"'std/stdc/clock.c'\" \(735 characters\)
- sed "s/^X//" >'std/stdc/clock.c' <<'END_OF_FILE'
- X/* clock() */
- X
- X#include <time.h>
- X
- X#if _BSD
- X
- X#include <sys/time.h>
- X#include <sys/resource.h>
- X
- Xclock_t
- Xclock()
- X{
- X struct timeval tv;
- X struct rusage ru;
- X
- X getrusage(RUSAGE_SELF, &ru);
- X tv.tv_sec = ru.ru_utime.tv_sec + ru.ru_stime.tv_sec;
- X tv.tv_usec = ru.ru_utime.tv_usec + ru.ru_stime.tv_usec;
- X return tv.tv_sec*CLK_TCK + (long)tv.tv_usec*CLK_TCK/1000000;
- X}
- X
- X#endif
- X
- X#if _V7 || _SYSV
- X
- X#include <sys/times.h>
- X
- Xclock_t
- Xclock()
- X{
- X struct tms tms;
- X
- X (void) times(&tms);
- X return tms.tms_utime + tms.tms_stime;
- X}
- X
- X#endif
- X
- X#if _ST
- X
- X#include <osbind.h>
- X
- Xclock_t
- Xclock()
- X{
- X long save;
- X clock_t c;
- X
- X /* access the ST's 200 HZ system clock in protected memory */
- X save = Super(0L);
- X c = *((long *)0x04BA);
- X (void)Super(save);
- X return c;
- X}
- X
- X#endif
- X
- END_OF_FILE
- if test 735 -ne `wc -c <'std/stdc/clock.c'`; then
- echo shar: \"'std/stdc/clock.c'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/clock.c'
- fi
- if test -f 'std/stdc/fprintf.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/fprintf.c'\"
- else
- echo shar: Extracting \"'std/stdc/fprintf.c'\" \(732 characters\)
- sed "s/^X//" >'std/stdc/fprintf.c' <<'END_OF_FILE'
- X/*
- X * printf and fprintf
- X */
- X
- X/* $Header */
- X
- X#if __STDC__
- X#include <stdarg.h>
- X#else
- X#include <varargs.h>
- X#endif
- X#include <stdio.h>
- X
- X#if _V7 || _BSD
- X
- X/* printf to stdout */
- Xint
- X#if __STDC__
- Xprintf(Const char *fmt, ...) {
- X#else
- Xprintf(va_alist) va_dcl
- X{
- X char *fmt;
- X#endif
- X va_list va;
- X
- X#if __STDC__
- X va_start(va, fmt);
- X#else
- X va_start(va);
- X fmt = va_arg(va, char *);
- X#endif
- X vfprintf(stdout, fmt, va);
- X va_end(va);
- X return 0;
- X}
- X
- Xint
- X#if __STDC__
- Xfprintf(FILE *f, Const char *fmt, ...) {
- X#else
- Xfprintf(va_alist) va_dcl
- X{
- X FILE *f;
- X char *fmt;
- X#endif
- X va_list va;
- X
- X#if __STDC__
- X va_start(va, fmt);
- X#else
- X va_start(va);
- X f = va_arg(va, FILE *);
- X fmt = va_arg(va, char *);
- X#endif
- X vfprintf(f, fmt, va);
- X va_end(va);
- X return 0;
- X}
- X
- X#endif
- END_OF_FILE
- if test 732 -ne `wc -c <'std/stdc/fprintf.c'`; then
- echo shar: \"'std/stdc/fprintf.c'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/fprintf.c'
- fi
- if test -f 'std/stdc/limits.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/limits.h'\"
- else
- echo shar: Extracting \"'std/stdc/limits.h'\" \(983 characters\)
- sed "s/^X//" >'std/stdc/limits.h' <<'END_OF_FILE'
- X/* Implementation-defined limits */
- X
- X#if __STDC__
- X#define Signed signed
- X#else
- X#define Signed
- X#endif
- X
- X#define CHAR_BIT 8
- X
- X#define _S_MIN(type) (-(Signed type)((unsigned type) ~0 >> 1) - 1)
- X#define _S_MAX(type) ((Signed type)((unsigned type) ~0 >> 1))
- X
- X#define UCHAR_MIN ((unsigned char) 0)
- X#define UCHAR_MAX ((unsigned char) ~0)
- X#define SCHAR_MIN _S_MIN(char)
- X#define SCHAR_MAX _S_MAX(char)
- X
- X/* some PCC compilers don't like the "elegant" definition of _UCHAR */
- X/* let the poor user provide -D_UCHAR=0 or 1 */
- X#ifndef _UCHAR
- X#define _UCHAR ((char) ~0 == (unsigned char) ~0)
- X#endif
- X#define CHAR_MIN (_UCHAR ? UCHAR_MIN : SCHAR_MIN)
- X#define CHAR_MAX (_UCHAR ? UCHAR_MAX : SCHAR_MAX)
- X
- X#define USHRT_MAX ((unsigned short) ~0)
- X#define SHRT_MIN _S_MIN(short)
- X#define SHRT_MAX _S_MAX(short)
- X
- X#define UINT_MAX ((unsigned int) ~0)
- X#define INT_MIN _S_MIN(int)
- X#define INT_MAX _S_MAX(int)
- X
- X#define ULONG_MAX ((unsigned long) ~0)
- X#define LONG_MIN _S_MIN(long)
- X#define LONG_MAX _S_MAX(long)
- X
- END_OF_FILE
- if test 983 -ne `wc -c <'std/stdc/limits.h'`; then
- echo shar: \"'std/stdc/limits.h'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/limits.h'
- fi
- if test -f 'std/stdc/memcmp.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/memcmp.c'\"
- else
- echo shar: Extracting \"'std/stdc/memcmp.c'\" \(358 characters\)
- sed "s/^X//" >'std/stdc/memcmp.c' <<'END_OF_FILE'
- X/* $Header$ */
- X
- X#include <string.h>
- X
- Xint
- Xmemcmp(dap, sap, n)
- X Const Void *dap;
- X Const Void *sap;
- X register size_t n;
- X{
- X register Const unsigned char *dp = (unsigned char Const *) dap;
- X register Const unsigned char *sp = (unsigned char Const *) sap;
- X
- X if (n++ > 0)
- X while (--n > 0)
- X if (*dp++ != *sp++)
- X return *--dp - *--sp; /* (int)? */
- X return 0;
- X}
- X
- END_OF_FILE
- if test 358 -ne `wc -c <'std/stdc/memcmp.c'`; then
- echo shar: \"'std/stdc/memcmp.c'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/memcmp.c'
- fi
- if test -f 'std/stdc/memmove.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/memmove.c'\"
- else
- echo shar: Extracting \"'std/stdc/memmove.c'\" \(336 characters\)
- sed "s/^X//" >'std/stdc/memmove.c' <<'END_OF_FILE'
- X/* $Header$ */
- X
- X#include <string.h>
- X
- XVoid *
- Xmemmove(dap, sap, n)
- X Void *dap;
- X Const Void *sap;
- X register size_t n;
- X{
- X register char *dp = dap, *sp = (Void*) sap;
- X
- X if (n <= 0)
- X ;
- X else if (dp < sp)
- X do *dp++ = *sp++; while (--n > 0);
- X else if (dp > sp) {
- X dp += n;
- X sp += n;
- X do *--dp = *--sp; while (--n > 0);
- X }
- X return dap;
- X}
- X
- X
- END_OF_FILE
- if test 336 -ne `wc -c <'std/stdc/memmove.c'`; then
- echo shar: \"'std/stdc/memmove.c'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/memmove.c'
- fi
- if test -f 'std/stdc/setvbuf.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/setvbuf.c'\"
- else
- echo shar: Extracting \"'std/stdc/setvbuf.c'\" \(1044 characters\)
- sed "s/^X//" >'std/stdc/setvbuf.c' <<'END_OF_FILE'
- X/*
- X * PD ksh needs an ANSI-compatible setvbuf.
- X * if (buf == NULL) it must also allocate a buffer
- X * and arrange for fclose to deallocate it.
- X * the reason for doing setvbuf(f, (char *)NULL, _IOFBF, BUFSIZ)
- X * in the shell is to avoid 4/8K buffers on BSD like systems.
- X */
- X
- X/* $Header */
- X
- X#include <stdlib.h>
- X#include <stdio.h>
- X
- X#if _BSD || _SYSV
- Xint
- Xsetvbuf(f, buf, type, size)
- X register FILE *f;
- X char *buf;
- X int type;
- X size_t size;
- X{
- X if ((f->_flag&_IOMYBUF) && f->_base != NULL)
- X free(f->_base);
- X f->_flag &= ~(_IOMYBUF|_IONBF|_IOFBF|_IOLBF);
- X switch (type) {
- X case _IONBF:
- X size = 0;
- X buf = NULL;
- X break;
- X case _IOLBF:
- X case _IOFBF:
- X if (size == 0)
- X size = BUFSIZ;
- X#if _V7
- X else if (size != BUFSIZ)
- X return -1;
- X#endif
- X if (buf == NULL) {
- X buf = malloc(size);
- X if (buf == NULL)
- X return -1;
- X f->_flag |= _IOMYBUF;
- X }
- X break;
- X default:
- X return -1;
- X }
- X f->_flag |= type;
- X f->_base = f->_ptr = buf;
- X f->_cnt = 0;
- X#if _BSD
- X f->_bufsiz = size;
- X#endif
- X#if _SYSV
- X _bufend(f) = buf + size;
- X#endif
- X return 0;
- X}
- X#endif
- X
- END_OF_FILE
- if test 1044 -ne `wc -c <'std/stdc/setvbuf.c'`; then
- echo shar: \"'std/stdc/setvbuf.c'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/setvbuf.c'
- fi
- if test -f 'std/stdc/sprintf.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/sprintf.c'\"
- else
- echo shar: Extracting \"'std/stdc/sprintf.c'\" \(795 characters\)
- sed "s/^X//" >'std/stdc/sprintf.c' <<'END_OF_FILE'
- X/*
- X * sprintf and vsprintf
- X */
- X
- X/* $Header */
- X
- X#if __STDC__
- X#include <stdarg.h>
- X#else
- X#include <varargs.h>
- X#endif
- X#include <stdio.h>
- X
- X#if _V7 || _BSD
- X
- Xint
- X#if __STDC__
- Xsprintf(char *s, Const char *fmt, ...) {
- X#else
- Xsprintf(va_alist) va_dcl
- X{
- X char *s;
- X char *fmt;
- X#endif
- X register va_list va;
- X int n;
- X
- X#if __STDC__
- X va_start(va, fmt);
- X#else
- X va_start(va);
- X s = va_arg(va, char *);
- X fmt = va_arg(va, char *);
- X#endif
- X n = vsprintf(s, fmt, va);
- X va_end(va);
- X return n;
- X}
- X
- Xint
- X#if __STDC__
- Xvsprintf(char *s, const char *fmt, va_list va) {
- X#else
- Xvsprintf(s, fmt, va)
- X char *s;
- X char *fmt;
- X va_list va;
- X{
- X#endif
- X int n;
- X static FILE siob;
- X
- X siob._flag = _IOWRT;
- X siob._base = siob._ptr = s;
- X siob._cnt = BUFSIZ;
- X siob._file = -1;
- X
- X n = vfprintf(&siob, fmt, va);
- X *siob._ptr = 0;
- X return n;
- X}
- X
- X#endif
- X
- END_OF_FILE
- if test 795 -ne `wc -c <'std/stdc/sprintf.c'`; then
- echo shar: \"'std/stdc/sprintf.c'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/sprintf.c'
- fi
- if test -f 'std/stdc/stdarg.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/stdarg.h'\"
- else
- echo shar: Extracting \"'std/stdc/stdarg.h'\" \(619 characters\)
- sed "s/^X//" >'std/stdc/stdarg.h' <<'END_OF_FILE'
- X#ifndef _STDARG_H
- X#define _STDARG_H
- X
- Xtypedef char *va_list;
- X
- X/* Amount of space required in an argument list for an arg of type TYPE.
- X TYPE may alternatively be an expression whose type is used. */
- X
- X#define __va_rounded_size(TYPE) \
- X (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
- X
- X#define va_start(AP, LASTARG) \
- X (AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG)))
- X
- Xvoid va_end (va_list); /* Defined in gnulib */
- X#define va_end(AP)
- X
- X#define va_arg(AP, TYPE) \
- X (AP += __va_rounded_size (TYPE), \
- X *((TYPE *) (AP - __va_rounded_size (TYPE))))
- X
- X#endif /* _STDARG_H */
- END_OF_FILE
- if test 619 -ne `wc -c <'std/stdc/stdarg.h'`; then
- echo shar: \"'std/stdc/stdarg.h'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/stdarg.h'
- fi
- if test -f 'std/stdc/stddef.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/stddef.h'\"
- else
- echo shar: Extracting \"'std/stdc/stddef.h'\" \(630 characters\)
- sed "s/^X//" >'std/stdc/stddef.h' <<'END_OF_FILE'
- X/* ANSI common definitions */
- X
- X/* $Header$ */
- X
- X#ifndef NULL
- X#if __STDC__
- X#define NULL (void*)0
- X#else
- X#define NULL 0
- X#endif
- X#endif
- X
- X#if ! _STDDEF_H
- X#define _STDDEF_H 1
- X
- X/* doesn't really belong here, but the library function need it */
- X#if __STDC__
- X#define ARGS(args) args
- X#define Void void
- X#define Const const
- X#else
- X#define ARGS(args) ()
- X#define Void char
- X#define Const
- X#endif
- X
- X#ifdef sparc
- X# include <sys/stdtypes.h>
- X#else
- Xtypedef unsigned size_t; /* may need long */
- Xtypedef int ptrdiff_t;
- X#endif /* sparc */
- X#define offsetof(type,id) ((size_t)&((type*)NULL)->id)
- X
- Xextern int errno; /* really belongs in <errno.h> */
- X
- X#endif
- X
- END_OF_FILE
- if test 630 -ne `wc -c <'std/stdc/stddef.h'`; then
- echo shar: \"'std/stdc/stddef.h'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/stddef.h'
- fi
- if test -f 'std/stdc/stdio.sed' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/stdio.sed'\"
- else
- echo shar: Extracting \"'std/stdc/stdio.sed'\" \(724 characters\)
- sed "s/^X//" >'std/stdc/stdio.sed' <<'END_OF_FILE'
- X/^#[ ]*include/d
- X/^#[ ]*define[ ]*NULL/d
- X/remove[ ]*([ ]*)/d
- X/rename[ ]*([ ]*)/d
- X/tmpfile[ ]*([ ]*)/d
- X/tmpnam[ ]*([ ]*)/d
- X/fopen[ ]*([ ]*)/d
- X/freopen[ ]*([ ]*)/d
- X/fdopen[ ]*([ ]*)/d
- X/fflush[ ]*([ ]*)/d
- X/fclose[ ]*([ ]*)/d
- X/setbuf[ ]*([ ]*)/d
- X/setvbuf[ ]*([ ]*)/d
- X/fseek[ ]*([ ]*)/d
- X/ftell[ ]*([ ]*)/d
- X/rewind[ ]*([ ]*)/d
- X/printf[ ]*([ ]*)/d
- X/fprintf[ ]*([ ]*)/d
- X/sprintf[ ]*([ ]*)/d
- X/vprintf[ ]*([ ]*)/d
- X/vfprintf[ ]*([ ]*)/d
- X/vsprintf[ ]*([ ]*)/d
- X/scanf[ ]*([ ]*)/d
- X/fscanf[ ]*([ ]*)/d
- X/sscanf[ ]*([ ]*)/d
- X/fread[ ]*([ ]*)/d
- X/frwrite[ ]*([ ]*)/d
- X/fgetc[ ]*([ ]*)/d
- X/fputc[ ]*([ ]*)/d
- X/fgets[ ]*([ ]*)/d
- X/fputs[ ]*([ ]*)/d
- X/gets[ ]*([ ]*)/d
- X/puts[ ]*([ ]*)/d
- END_OF_FILE
- if test 724 -ne `wc -c <'std/stdc/stdio.sed'`; then
- echo shar: \"'std/stdc/stdio.sed'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/stdio.sed'
- fi
- if test -f 'std/stdc/stdlib.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/stdlib.h'\"
- else
- echo shar: Extracting \"'std/stdc/stdlib.h'\" \(1104 characters\)
- sed "s/^X//" >'std/stdc/stdlib.h' <<'END_OF_FILE'
- X/* ANSI utility functions */
- X
- X/* $Header: stdlib.h,v 1.1 88/03/09 21:52:59 egisin Locked $ */
- X
- X#if ! _STDLIB_H
- X#define _STDLIB_H 1
- X
- X#include <stddef.h>
- X
- Xdouble atof ARGS((const char *s));
- Xint atoi ARGS((const char *s));
- Xlong atol ARGS((const char *s));
- Xdouble strtod ARGS((const char *s, char **));
- Xlong strtol ARGS((const char *s, char **, int base));
- Xunsigned long strtoul ARGS((const char *s, char **, int base));
- Xint rand ARGS((void));
- Xvoid srand ARGS((unsigned int seed));
- XVoid *malloc ARGS((size_t size));
- XVoid *realloc ARGS((void *ptr, size_t size));
- XVoid *calloc ARGS((size_t n, size_t size));
- Xvoid free ARGS((void *ptr));
- Xvoid abort ARGS((void));
- Xint atexit ARGS((void (*func)(void)));
- Xvoid exit ARGS((int status));
- Xchar *getenv ARGS((const char *name));
- Xint system ARGS((const char *cmd));
- Xvoid *bsearch ARGS ((const void *key, const void *base, size_t n, size_t size,
- X int (*compar)(const void *, const void *)));
- Xvoid *qsort ARGS ((const void *base, size_t n, size_t size,
- X int (*compar)(const void *, const void *)));
- X#define abs(a) ((a) < 0 : -(a) : (a))
- X
- X#endif
- X
- END_OF_FILE
- if test 1104 -ne `wc -c <'std/stdc/stdlib.h'`; then
- echo shar: \"'std/stdc/stdlib.h'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/stdlib.h'
- fi
- if test -f 'std/stdc/strchr.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/strchr.c'\"
- else
- echo shar: Extracting \"'std/stdc/strchr.c'\" \(423 characters\)
- sed "s/^X//" >'std/stdc/strchr.c' <<'END_OF_FILE'
- X#include <string.h>
- X
- X/*
- X * strchr - find first occurrence of a character in a string
- X */
- X
- Xchar * /* found char, or NULL if none */
- Xstrchr(s, charwanted)
- XConst char *s;
- Xregister char charwanted;
- X{
- X register Const char *scan;
- X
- X /*
- X * The odd placement of the two tests is so NUL is findable.
- X */
- X for (scan = s; *scan != charwanted;) /* ++ moved down for opt. */
- X if (*scan++ == '\0')
- X return(NULL);
- X return(scan);
- X}
- END_OF_FILE
- if test 423 -ne `wc -c <'std/stdc/strchr.c'`; then
- echo shar: \"'std/stdc/strchr.c'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/strchr.c'
- fi
- if test -f 'std/stdc/strcmp.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/strcmp.c'\"
- else
- echo shar: Extracting \"'std/stdc/strcmp.c'\" \(758 characters\)
- sed "s/^X//" >'std/stdc/strcmp.c' <<'END_OF_FILE'
- X#include <string.h>
- X
- X/* Modified by Eric Gisin */
- X
- X/*
- X * strcmp - compare string s1 to s2
- X */
- X
- Xint /* <0 for <, 0 for ==, >0 for > */
- Xstrcmp(s1, s2)
- XConst char *s1;
- XConst char *s2;
- X{
- X register Const char *scan1;
- X register Const char *scan2;
- X#if 0 /* some machines prefer int to char */
- X register int c1, c2;
- X#else
- X register char c1, c2;
- X#endif
- X
- X scan1 = s1;
- X scan2 = s2;
- X while ((c1 = *scan1++) == (c2 = *scan2++) && c1 != 0)
- X ;
- X
- X /*
- X * The following case analysis is necessary so that characters
- X * which look negative collate low against normal characters but
- X * high against the end-of-string NUL.
- X */
- X if (c1 == '\0' && c2 == '\0')
- X return(0);
- X else if (c1 == '\0')
- X return(-1);
- X else if (c2 == '\0')
- X return(1);
- X else
- X return(c1 - c2);
- X}
- END_OF_FILE
- if test 758 -ne `wc -c <'std/stdc/strcmp.c'`; then
- echo shar: \"'std/stdc/strcmp.c'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/strcmp.c'
- fi
- if test -f 'std/stdc/strcspn.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/strcspn.c'\"
- else
- echo shar: Extracting \"'std/stdc/strcspn.c'\" \(467 characters\)
- sed "s/^X//" >'std/stdc/strcspn.c' <<'END_OF_FILE'
- X#include <string.h>
- X
- X/*
- X * strcspn - find length of initial segment of s consisting entirely
- X * of characters not from reject
- X */
- X
- Xsize_t
- Xstrcspn(s, reject)
- XConst char *s;
- XConst char *reject;
- X{
- X register Const char *scan;
- X register Const char *rscan;
- X register size_t count;
- X
- X count = 0;
- X for (scan = s; *scan != '\0'; scan++) {
- X for (rscan = reject; *rscan != '\0';) /* ++ moved down. */
- X if (*scan == *rscan++)
- X return(count);
- X count++;
- X }
- X return(count);
- X}
- END_OF_FILE
- if test 467 -ne `wc -c <'std/stdc/strcspn.c'`; then
- echo shar: \"'std/stdc/strcspn.c'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/strcspn.c'
- fi
- if test -f 'std/stdc/string.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/string.h'\"
- else
- echo shar: Extracting \"'std/stdc/string.h'\" \(1310 characters\)
- sed "s/^X//" >'std/stdc/string.h' <<'END_OF_FILE'
- X/* ANSI string handling (missing wide char stuff) */
- X
- X#if ! _STRING_H
- X#define _STRING_H 1
- X
- X#include <stddef.h> /* define NULL and size_t */
- X
- X#if __STDC__
- X#define ARGS(args) args
- X#define Void void
- X#else
- X#define ARGS(args) ()
- X#define Void char
- X#endif
- X
- XVoid *memcpy ARGS((Void *s1, const Void *s2, size_t));
- XVoid *memmove ARGS((Void *s1, const Void *s2, size_t));
- Xint memcmp ARGS((const Void *s1, const Void *s2, size_t));
- XVoid *memchr ARGS((const Void *s, int c, size_t));
- XVoid *memset ARGS((Void *s, int c, size_t));
- Xsize_t strlen ARGS((const char *s));
- Xchar *strcpy ARGS((char *s1, const char *s2));
- Xchar *strncpy ARGS((char *s1, const char *s2, size_t));
- Xchar *strcat ARGS((char *s1, const char *s2));
- Xchar *strncat ARGS((char *s1, const char *s2, size_t));
- Xint strcmp ARGS((const char *s1, const char *s2));
- Xint strncmp ARGS((const char *s1, const char *s2, size_t));
- Xchar *strchr ARGS((const char *s1, int c));
- Xchar *strrchr ARGS((const char *s1, int c));
- Xsize_t strspn ARGS((const char *s1, const char *s2));
- Xsize_t strcspn ARGS((const char *s1, const char *s2));
- Xchar *strpbrk ARGS((const char *s1, const char *s2));
- Xchar *strstr ARGS((const char *s1, const char *s2));
- Xchar *strtok ARGS((char *s1, const char *s2));
- Xchar *strerror ARGS((int errno));
- X
- X#endif /* _STRING_H */
- X
- END_OF_FILE
- if test 1310 -ne `wc -c <'std/stdc/string.h'`; then
- echo shar: \"'std/stdc/string.h'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/string.h'
- fi
- if test -f 'std/stdc/strncat.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/strncat.c'\"
- else
- echo shar: Extracting \"'std/stdc/strncat.c'\" \(427 characters\)
- sed "s/^X//" >'std/stdc/strncat.c' <<'END_OF_FILE'
- X#include <string.h>
- X
- X/*
- X * strncat - append at most n characters of string src to dst
- X */
- Xchar * /* dst */
- Xstrncat(dst, src, n)
- Xchar *dst;
- XConst char *src;
- Xsize_t n;
- X{
- X register char *dscan;
- X register Const char *sscan;
- X register size_t count;
- X
- X for (dscan = dst; *dscan != '\0'; dscan++)
- X continue;
- X sscan = src;
- X count = n;
- X while (*sscan != '\0' && --count >= 0)
- X *dscan++ = *sscan++;
- X *dscan++ = '\0';
- X return(dst);
- X}
- END_OF_FILE
- if test 427 -ne `wc -c <'std/stdc/strncat.c'`; then
- echo shar: \"'std/stdc/strncat.c'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/strncat.c'
- fi
- if test -f 'std/stdc/strncmp.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/strncmp.c'\"
- else
- echo shar: Extracting \"'std/stdc/strncmp.c'\" \(778 characters\)
- sed "s/^X//" >'std/stdc/strncmp.c' <<'END_OF_FILE'
- X#include <string.h>
- X
- X/*
- X * strncmp - compare at most n characters of string s1 to s2
- X */
- X
- Xint /* <0 for <, 0 for ==, >0 for > */
- Xstrncmp(s1, s2, n)
- XConst char *s1;
- XConst char *s2;
- Xsize_t n;
- X{
- X register Const char *scan1;
- X register Const char *scan2;
- X register size_t count;
- X
- X scan1 = s1;
- X scan2 = s2;
- X count = n;
- X while (--count >= 0 && *scan1 != '\0' && *scan1 == *scan2) {
- X scan1++;
- X scan2++;
- X }
- X if (count < 0)
- X return(0);
- X
- X /*
- X * The following case analysis is necessary so that characters
- X * which look negative collate low against normal characters but
- X * high against the end-of-string NUL.
- X */
- X if (*scan1 == '\0' && *scan2 == '\0')
- X return(0);
- X else if (*scan1 == '\0')
- X return(-1);
- X else if (*scan2 == '\0')
- X return(1);
- X else
- X return(*scan1 - *scan2);
- X}
- END_OF_FILE
- if test 778 -ne `wc -c <'std/stdc/strncmp.c'`; then
- echo shar: \"'std/stdc/strncmp.c'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/strncmp.c'
- fi
- if test -f 'std/stdc/strncpy.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/strncpy.c'\"
- else
- echo shar: Extracting \"'std/stdc/strncpy.c'\" \(410 characters\)
- sed "s/^X//" >'std/stdc/strncpy.c' <<'END_OF_FILE'
- X#include <string.h>
- X
- X/*
- X * strncpy - copy at most n characters of string src to dst
- X */
- Xchar * /* dst */
- Xstrncpy(dst, src, n)
- Xchar *dst;
- XConst char *src;
- Xsize_t n;
- X{
- X register char *dscan;
- X register Const char *sscan;
- X register size_t count;
- X
- X dscan = dst;
- X sscan = src;
- X count = n;
- X while (--count >= 0 && (*dscan++ = *sscan++) != '\0')
- X continue;
- X while (--count >= 0)
- X *dscan++ = '\0';
- X return(dst);
- X}
- END_OF_FILE
- if test 410 -ne `wc -c <'std/stdc/strncpy.c'`; then
- echo shar: \"'std/stdc/strncpy.c'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/strncpy.c'
- fi
- if test -f 'std/stdc/strpbrk.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/strpbrk.c'\"
- else
- echo shar: Extracting \"'std/stdc/strpbrk.c'\" \(427 characters\)
- sed "s/^X//" >'std/stdc/strpbrk.c' <<'END_OF_FILE'
- X#include <string.h>
- X
- X/*
- X * strpbrk - find first occurrence of any char from breakat in s
- X */
- X
- Xchar * /* found char, or NULL if none */
- Xstrpbrk(s, breakat)
- XConst char *s;
- XConst char *breakat;
- X{
- X register Const char *sscan;
- X register Const char *bscan;
- X
- X for (sscan = s; *sscan != '\0'; sscan++) {
- X for (bscan = breakat; *bscan != '\0';) /* ++ moved down. */
- X if (*sscan == *bscan++)
- X return(sscan);
- X }
- X return(NULL);
- X}
- END_OF_FILE
- if test 427 -ne `wc -c <'std/stdc/strpbrk.c'`; then
- echo shar: \"'std/stdc/strpbrk.c'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/strpbrk.c'
- fi
- if test -f 'std/stdc/strrchr.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/strrchr.c'\"
- else
- echo shar: Extracting \"'std/stdc/strrchr.c'\" \(415 characters\)
- sed "s/^X//" >'std/stdc/strrchr.c' <<'END_OF_FILE'
- X#include <string.h>
- X
- X/*
- X * strrchr - find last occurrence of a character in a string
- X */
- X
- Xchar * /* found char, or NULL if none */
- Xstrrchr(s, charwanted)
- XConst char *s;
- Xregister char charwanted;
- X{
- X register Const char *scan;
- X register Const char *place;
- X
- X place = NULL;
- X for (scan = s; *scan != '\0'; scan++)
- X if (*scan == charwanted)
- X place = scan;
- X if (charwanted == '\0')
- X return(scan);
- X return(place);
- X}
- END_OF_FILE
- if test 415 -ne `wc -c <'std/stdc/strrchr.c'`; then
- echo shar: \"'std/stdc/strrchr.c'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/strrchr.c'
- fi
- if test -f 'std/stdc/strspn.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/strspn.c'\"
- else
- echo shar: Extracting \"'std/stdc/strspn.c'\" \(483 characters\)
- sed "s/^X//" >'std/stdc/strspn.c' <<'END_OF_FILE'
- X#include <string.h>
- X
- X/*
- X * strspn - find length of initial segment of s consisting entirely
- X * of characters from accept
- X */
- X
- Xsize_t
- Xstrspn(s, accept)
- XConst char *s;
- XConst char *accept;
- X{
- X register Const char *sscan;
- X register Const char *ascan;
- X register size_t count;
- X
- X count = 0;
- X for (sscan = s; *sscan != '\0'; sscan++) {
- X for (ascan = accept; *ascan != '\0'; ascan++)
- X if (*sscan == *ascan)
- X break;
- X if (*ascan == '\0')
- X return(count);
- X count++;
- X }
- X return(count);
- X}
- END_OF_FILE
- if test 483 -ne `wc -c <'std/stdc/strspn.c'`; then
- echo shar: \"'std/stdc/strspn.c'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/strspn.c'
- fi
- if test -f 'std/stdc/strstr.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/strstr.c'\"
- else
- echo shar: Extracting \"'std/stdc/strstr.c'\" \(595 characters\)
- sed "s/^X//" >'std/stdc/strstr.c' <<'END_OF_FILE'
- X#include <string.h>
- X
- X/*
- X * strstr - find first occurrence of wanted in s
- X */
- X
- Xchar * /* found string, or NULL if none */
- Xstrstr(s, wanted)
- XConst char *s;
- XConst char *wanted;
- X{
- X register Const char *scan;
- X register size_t len;
- X register char firstc;
- X
- X /*
- X * The odd placement of the two tests is so "" is findable.
- X * Also, we inline the first char for speed.
- X * The ++ on scan has been moved down for optimization.
- X */
- X firstc = *wanted;
- X len = strlen(wanted);
- X for (scan = s; *scan != firstc || strncmp(scan, wanted, len) != 0; )
- X if (*scan++ == '\0')
- X return(NULL);
- X return(scan);
- X}
- END_OF_FILE
- if test 595 -ne `wc -c <'std/stdc/strstr.c'`; then
- echo shar: \"'std/stdc/strstr.c'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/strstr.c'
- fi
- if test -f 'std/stdc/strtok.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/strtok.c'\"
- else
- echo shar: Extracting \"'std/stdc/strtok.c'\" \(1108 characters\)
- sed "s/^X//" >'std/stdc/strtok.c' <<'END_OF_FILE'
- X#include <string.h>
- X
- X/*
- X * Get next token from string s (NULL on 2nd, 3rd, etc. calls),
- X * where tokens are nonempty strings separated by runs of
- X * chars from delim. Writes NULs into s to end tokens. delim need not
- X * remain constant from call to call.
- X */
- X
- Xstatic char *scanpoint = NULL;
- X
- Xchar * /* NULL if no token left */
- Xstrtok(s, delim)
- Xchar *s;
- Xregister Const char *delim;
- X{
- X register char *scan;
- X char *tok;
- X register Const char *dscan;
- X
- X if (s == NULL && scanpoint == NULL)
- X return(NULL);
- X if (s != NULL)
- X scan = s;
- X else
- X scan = scanpoint;
- X
- X /*
- X * Scan leading delimiters.
- X */
- X for (; *scan != '\0'; scan++) {
- X for (dscan = delim; *dscan != '\0'; dscan++)
- X if (*scan == *dscan)
- X break;
- X if (*dscan == '\0')
- X break;
- X }
- X if (*scan == '\0') {
- X scanpoint = NULL;
- X return(NULL);
- X }
- X
- X tok = scan;
- X
- X /*
- X * Scan token.
- X */
- X for (; *scan != '\0'; scan++) {
- X for (dscan = delim; *dscan != '\0';) /* ++ moved down. */
- X if (*scan == *dscan++) {
- X scanpoint = scan+1;
- X *scan = '\0';
- X return(tok);
- X }
- X }
- X
- X /*
- X * Reached end of string.
- X */
- X scanpoint = NULL;
- X return(tok);
- X}
- END_OF_FILE
- if test 1108 -ne `wc -c <'std/stdc/strtok.c'`; then
- echo shar: \"'std/stdc/strtok.c'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/strtok.c'
- fi
- if test -f 'std/stdc/time.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/time.h'\"
- else
- echo shar: Extracting \"'std/stdc/time.h'\" \(951 characters\)
- sed "s/^X//" >'std/stdc/time.h' <<'END_OF_FILE'
- X/* time, time/date conversion */
- X
- X#if ! _TIME_H
- X#define _TIME_H 1
- X
- X#include <stddef.h> /* need size_t */
- X
- X#ifndef sparc
- Xtypedef long time_t;
- Xtypedef long clock_t; /* seconds/CLK_TCK */
- X#endif
- X
- X#if _V7 || _SYSV
- X#define CLK_TCK 60 /* todo: get from <sys/param.h> */
- X#endif
- X
- X#if _BSD
- X#define CLK_TCK 100
- X#endif
- X
- X#if _ST
- X#define CLK_TCK 200 /* ST system clock */
- X#endif
- X
- Xstruct tm {
- X int tm_sec, tm_min, tm_hour;
- X int tm_mday, tm_mon, tm_year, tm_wday, tm_yday;
- X int tm_isdst;
- X long tm_gmtoff; /* BSD */
- X char *tm_zone; /* BSD */
- X};
- X
- Xclock_t clock ARGS((void));
- Xtime_t time ARGS((time_t *tp));
- X#define difftime(t1, t2) (double)((t2)-(t1))
- Xtime_t mktime ARGS((struct tm *tmp));
- Xchar *asctime ARGS((const struct tm *tmp));
- Xchar *ctime ARGS((const time_t *tp));
- Xstruct tm *gmtime ARGS((const time_t *tp));
- Xstruct tm *localtime ARGS((const time_t *tp));
- Xsize_t strftime ARGS((char *buf, size_t len, const char *fmt, const struct tm *tmp));
- X
- X#endif
- X
- END_OF_FILE
- if test 951 -ne `wc -c <'std/stdc/time.h'`; then
- echo shar: \"'std/stdc/time.h'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/time.h'
- fi
- if test -f 'std/stdc/types.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'std/stdc/types.h'\"
- else
- echo shar: Extracting \"'std/stdc/types.h'\" \(371 characters\)
- sed "s/^X//" >'std/stdc/types.h' <<'END_OF_FILE'
- X/* work around multiple typedefs in stddef.h and sys/types.h */
- X
- X#include <stddef.h> /* defines size_t and ptrdiff_t */
- X#include <time.h> /* defines time_t and clock_t */
- X
- X/* "inhibit" the typedefs in sys/types.h */
- X#define size_t _size_t
- X#define time_t _time_t
- X#define clock_t _clock_t
- X#include "/./usr/include/sys/types.h"
- X#undef size_t
- X#undef time_t
- X#undef clock_t
- X
- END_OF_FILE
- if test 371 -ne `wc -c <'std/stdc/types.h'`; then
- echo shar: \"'std/stdc/types.h'\" unpacked with wrong size!
- fi
- # end of 'std/stdc/types.h'
- fi
- echo shar: End of archive 8 \(of 9\).
- cp /dev/null ark8isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 9 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
- Sterling Software, IMD UUCP: uunet!sparky!kent
- Phone: (402) 291-8300 FAX: (402) 291-4362
- Please send comp.sources.misc-related mail to kent@uunet.uu.net.
-